<template>
	<view class="container show-box">
		<view class="content" v-if="list.length == 0">
			<image src="/static/images/shop/empty.png" mode=""></image>
			<text>亲,暂无推广记录哦</text>
		</view>
		<view v-else>
			<view class="list">
				<view class="detail" v-for="(detail,index1) in list" :key='index1'>
					
					<view class="fotter">
						<view class="flex">
							<image :src="detail.avatar" mode=""></image>
							<view class="fot_con">
								<view class="top">
									<text style="color: #000;">{{detail.nickname }}</text>
								</view>
								<view class="bottom">
									<text>{{detail.times }}</text>
								</view>
							</view>
						</view>
						<text style="color: #FA436A;">+ {{detail.money }}</text>
					</view>
				</view>
			</view>
		</view>


	</view>
</template>

<script>
	export default {
		components: {

		},
		data() {
			return {
				page: 1,
				limit: 10,
				count: 0,
				list: []
			};
		},

		onLoad(options) {
			// 页面显示是默认选中第一个
			this.tabCurrentIndex = 0;
			this.init();
		},

		methods: {
			// 推广明细
			init() {
				let { page, limit, list } = this;
				uni.hideLoading()
				this.$api.post({
					url: '/share/earningsOrder',
					data: {page, limit},
					success: res => {
						this.count = res.count;
						this.list.push(...res.list)
					}
				})
			}
		},
		// 页面上拉触底
		onReachBottom() {
			uni.showLoading({title: "加载中"})
			if(this.list.length < Number(this.count)) {
				this.page ++
				this.init()
			} else {
				uni.hideLoading();
				this.$api.msg('已经到底了');
			}
		}
	};
</script>

<style scoped lang="scss">
	page,
	.container {
		// background: $page-color-base;
		height: 100%;
	}

	.swiper-box {
		height: calc(100% - 80upx);
	}

	.list-scroll-content {
		height: 100%;
	}

	.navbar {
		display: flex;
		height: 40px;
		padding: 0 5px;
		background: #fff;
		box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
		position: relative;
		z-index: 10;

		.nav-item {
			flex: 1;
			display: flex;
			justify-content: center;
			align-items: center;
			height: 100%;
			font-size: 15px;
			color: #666666;
			position: relative;

			&.current {
				color: #FC6B00;

				&:after {
					content: '';
					position: absolute;
					left: 50%;
					bottom: 0;
					transform: translateX(-50%);
					width: 100%;
					height: 0;
					border-bottom: 2px solid #FC6B00;
				}
			}
		}
	}

	.content {
		width: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;

		image {
			width: 218upx;
			height: 120upx;
			margin: 100upx 0 30upx;
		}

		text {
			font-size: 28upx;
			color: #999999;
		}
	}

	.list {
		padding: 0 30upx;
		margin-top: 30upx;

		.detail {
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			align-items: center;
			// border-bottom: 1upx solid #EBE7E7;
			font-size: 28upx;
			font-family: Source Han Sans CN;
			font-weight: 400;
			color: #333333;

			.header {
				width: 100%;
				display: flex;
				justify-content: space-between;
				font-size: 24upx;
				color: #333;
			}

			.fotter {
				width: 100%;
				height: 100upx;
				margin-top: 10upx;
				color: #777777;
				display: flex;
				justify-content: space-between;
				border-bottom: 1upx solid #EBE7E7;
				align-items: center;
				image {
					width: 80upx;
					height: 80upx;
					border-radius: 50%;
					overflow: hidden;
					margin-right: 10rpx;
				}

				.fot_con {
					.top {
						display: flex;
						justify-content: space-between;
						height: 40upx;
						line-height: 40upx;
					}

					.bottom {
						display: flex;
						justify-content: space-between;
						height: 40upx;
						line-height: 40upx;
					}
				}
			}


		}

		:last-child {
			border: none;
		}
	}
</style>
